<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<script type="text/javascript" charset="UTF-8">
	var tree;
	var data;
	var treeData = ${treeData};
	var urlPrefix = "${basePath}";
	$(function() {
		tree = $("#leftTreeDiv").tree(
				{
					data : treeData,
					animate : false,
					lines : false,
					onClick : function(node) {
						if (node.attributes != null
								&& node.attributes[0].controllerName != ''
								&& node.attributes[0].Name != '') {
							var href = urlPrefix
									+ node.attributes[0].controllerName + "/"
									+ node.attributes[0].Name + ".do";

							gotoPage(node.text, href);
						}
					},
					onLoadSuccess : function(node, data) {
						var t = $(this);
						if (data) {
							$(data).each(function(index, d) {
								if (this.state == 'closed') {
									//t.tree('expandAll');
								}
							});
						}
					}
				});

	});
	function collapseAll() {
		var node = tree.tree('getSelected');
		if (node) {
			tree.tree('collapseAll', node.target);
		} else {
			tree.tree('collapseAll');
		}
	}
	function expandAll() {
		var node = tree.tree('getSelected');
		if (node) {
			tree.tree('expandAll', node.target);
		} else {
			tree.tree('expandAll');
		}
	}
</script>
